﻿using MessageBoxNS;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

/**
 *Copyright(C) 2019 by 殊未
 *All rights reserved.
 *FileName:     
 *Author:      丁冉
 *Version:      BVP3.0
 *UnityVersion:    2018.4.0
 *Date:         #DATE#
 *Description:   
 *History:
*/

public class FileSetting : MonoBehaviour
{
    public UIController uIController;
    public Button OutputBtn;
    public Button LookOldTab;
    public Button LookNewTab;
    private void Start()
    {
        LookOldTab.onClick.AddListener(LookOldTabClick);
        LookNewTab.onClick.AddListener(LookNewTabClick);
        OutputBtn.onClick.AddListener(OutputBtnClick);
    }

    private void OutputBtnClick()
    {
        string rangeStr = Guid.NewGuid().ToString();
        if (uIController.IsColumnAnArray())
        {
            MessageBox.ShowConfirmMessageBox("MessageBox", "输入列数大于总列数", "知道了");
            return;
        }
        DoExcel.WriteExcel(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "/" + rangeStr + ".xls", uIController.GetNewDataDic());
        MessageBox.ShowConfirmMessageBox("MessageBox", "输出成功,前往桌面查看  " + rangeStr + ".xls", "知道了");
    }


    #region TODO
    private void LookNewTabClick()
    {
        MessageBox.ShowConfirmMessageBox("MessageBox", "功能尚未开发,请等待后续", "知道了");
    }

    private void LookOldTabClick()
    {
        MessageBox.ShowConfirmMessageBox("MessageBox", "功能尚未开发,请等待后续", "知道了");
    }
    #endregion
}
